<template>
  <div>
    <div class="nav_main">
      <!-- 导航建议用router-link标签 -->
      <span @click="btn('/find/recommend','Recommend')">推荐</span>
      <span @click="btn('/find/ranking','Ranking')">排行榜</span>
      <span @click="btn('/find/songList','SongList')">歌单</span>
    </div>

    <div style="1px solid tomato;">
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
export default {
  methods:{
    btn(path,name){
      this.$router.push({
        path,
        name
      })
    }
  },
  beforeCreate(){
    console.log('Find被创建');
  },
  beforeDestroy(){
    console.log('Find被销毁');
  },
  activated(){
    console.log('Find被激活');
  },
  deactivated(){
    console.log('Find失去激活')
  }
}
</script>

<style scoped>
.nav_main {
  background-color: #41b883;
  color: white;
  padding: 10px 0;
}
.nav_main span {
  text-align: center;
  text-decoration: none;
  color: white;
  font-size: 13px;
  margin: 7px 17px 0;
  padding: 0px 15px 2px 15px;
  height: 20px;
  display: inline-block;
  line-height: 20px;
  border-radius: 20px;
}
.nav_main span:hover {
  background-color: #34495e;
}
.nav_main .router-link-active {
  background-color: #34495e;
}
</style>